package com.gexiaobao.pigeon.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.CarListBean
import com.gexiaobao.pigeon.app.util.ImageLoaderManager
import com.gexiaobao.pigeon.databinding.ItemCarInfoBinding
import com.makeramen.roundedimageview.RoundedImageView

/**
 * @Author      : hxw
 * @Date        : 2024/7/3 11:19
 * @Describe    :
 */
class AdapterCarInfo : BaseQuickAdapter<CarListBean, DataBindBaseViewHolder>(R.layout.item_car_info) {

    override fun convert(holder: DataBindBaseViewHolder, item: CarListBean) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemCarInfoBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        val ivCarImage = holder.getView<RoundedImageView>(R.id.ivCarPicture)
        ImageLoaderManager.loadRoundImage(context, item.travelCardPicUrl, ivCarImage, 20)
    }
}